package com.sky.controller.user;

import com.sky.constant.ShopConstant;
import com.sky.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ShopController
 *
 * @author liliudong
 * @version 1.0
 * @description 店铺控制器
 * @date 2023/7/31 16:18
 */
@RestController("userShopController")
@RequestMapping("/user/shop")
public class ShopController {

    @Autowired
    private RedisTemplate redisTemplate;

    /**
     * 状态
     *
     * @return {@link Result}<{@link Integer}>
     */
    @GetMapping("/status")
    public Result<Integer> status() {
        ValueOperations valueOperations = redisTemplate.opsForValue();
        Integer status = (Integer) valueOperations.get(ShopConstant.SHOP_STATUS);
        return Result.success(status);
    }
}
